
#The frozenset function constructs a frozenset, which is identical to a normal set with two notable differences:

#DIFFRENCE 1 MUTTABLE IMMUTABLE
mylist = [0,1,2,3]
myset  = set(mylist)
# sets are mutable, we can add and remove elements

myset.add(4)
myfrozenset = frozenset(mylist)
# frozensets are immutable, you cannot add or remove elements => not works! myfrozenset.add(4)

#DIFFRENCE 2 HASHABLE NOT HASHABLE
mylist = [0,1,2,3]
myset  = set(mylist)

# sets are not hashable hash(mylist) cause TypeError: unhashable type: 'set'
#hash(myset) consequently, they cannot be used as dictionary keys as this {myset: "myvalue"}
# frozensets are hashable, and can thus be used as dictionary keys

myfrozenset = frozenset(mylist)
dictionary  = {myfrozenset: "myvalue"}
print dictionary



